import React from 'react';
function genCustomFilter(Filter, filterProps) {
    return function Com(props) {
        const { setSelectedKeys, selectedKeys, confirm, clearFilters, close } = props;
        const filterChange = (v) => {
            // ! 入参v类型必须是数组，否则antd table不接收
            // * 合并setSelectedKeys和confirm成一个change方法，简化接入的filter组件操作
            if (!Array.isArray(v)) console.warn('FilterChange方法入参格式必须为数组!')
            setSelectedKeys(v);
            confirm();
        }
        return <Filter
            {...filterProps}
            filterChange={filterChange}
            setSelectedKeys={setSelectedKeys}
            selectedKeys={selectedKeys}
            confirm={confirm}
            clearFilters={clearFilters}
            close={close}
        />;
    }
}
export default genCustomFilter;